using UnityEngine;
using UnityEditor;

namespace Runtime.Module.GameGraphic.Editor
{


    [CustomEditor(typeof(Transform),true)]
    public class CustomTransformEditor : IsScriptCtrlEditor<Transform>
    {
        private UnityEditor.Editor defaultEditor;
        private string customField = "";

        protected override void OnEnable()
        {
            base.OnEnable();
            // Get the internal TransformInspector type
            var editorAssembly = typeof(UnityEditor.Editor).Assembly;
            var transformInspectorType = editorAssembly.GetType("UnityEditor.TransformInspector");

            // Create an instance of the internal TransformInspector
            defaultEditor = CreateEditor(target, transformInspectorType);
        }

        protected override void OnDisable()
        {
            base.OnDisable();
            // Destroy the instance of the internal TransformInspector
            if (defaultEditor != null)
            {
                DestroyImmediate(defaultEditor);
            }
        }


        public override void OnInspectorGUI()
        {
            OnInspectorGUIOfScript();
            // Draw the default Transform inspector using the internal editor
            if (defaultEditor != null)
            {
                defaultEditor.OnInspectorGUI();
            }
        }
    }
}